package v1beta1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=sso
// +kubebuilder:subresource:status

// AttachVolume is the Schema for the c API
type OBVolume struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              OBVolumeSpec `json:"spec,omitempty"`
	// status of Obvolume
	Status OBVolumeStatus `json:"status,omitempty"`
}

type OBVolumeSpec struct {
	//+optional
	OwnerId string `json:"ownerId,omitempty"`
	// provider secret
	ProviderRef      ProviderRef      `json:"providerRef,omitempty"`
	ResourceAffinity ResourceAffinity `json:"resourceAffinity,omitempty"`
	// unit:  M
	Size  int32  `json:"size,omitempty"`
	Owner string `json:"owner,omitempty"`
}

type OBPhase string

const (
	OBAvaliablePhase OBPhase = "avaliable"
)

type OBVolumeStatus struct {
	Phase  OBPhase `json:"phase,omitempty"`
	Bucket Bucket  `json:"bucket,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// AttachVolumeList contains a list of AttachVolume item
type OBVolumeList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []OBVolume `json:"items"`
}

type Bucket struct {
	Addr string `json:"addr,omitempty"`
}
